﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptKhachHangNoVuotDinhMuc : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("AdvTaiKhoan")]
        private ADVAccount _AdvTaiKhoan;
        [AccessedThroughProperty("CboDonVi")]
        private ComboBox _CboDonVi;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("CmdPrint")]
        private Button _CmdPrint;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label13")]
        private Label _Label13;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;

        [DebuggerNonUserCode]
        public Frm_RptKhachHangNoVuotDinhMuc()
        {
            base.Load += new EventHandler(this.Frm_RptKhachHangNoVuotDinhMuc_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            this.PrintReport();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_RptKhachHangNoVuotDinhMuc_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CboDonVi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CboDonVi.SelectedValue = modGeneral.H_CLIENT;
                this.AdvTaiKhoan.DefaultValue = "131";
                this.AdvTaiKhoan.SetDefault();
            }
        }

        public object GetData()
        {
            object obj2;
            string listKhoaTaiKhoanCon = new clsDMTaiKhoan().GetListKhoaTaiKhoanCon(this.AdvTaiKhoan.Value);
            string str = LVYModule.Date2Char(this.TxtTuNgay.Text);
            string str3 = LVYModule.sLeft(str, 6) + "01";
            IDataParameter[] commandParameters = new IDataParameter[7];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@TuNgay", DbType.Int64, ParameterDirection.Input, str3);
                commandParameters[1] = DBHelper.createParameter("@DenNgay", DbType.Int64, ParameterDirection.Input, str);
                commandParameters[2] = DBHelper.createParameter("@KhoaTaiKhoan", DbType.Int64, ParameterDirection.Input, this.AdvTaiKhoan.Value);
                commandParameters[3] = DBHelper.createParameter("@KhoaBaoCao", DbType.Int64, ParameterDirection.Input, "");
                commandParameters[4] = DBHelper.createParameter("@Language", DbType.Int64, ParameterDirection.Input, modGeneral.H_LANGUAGE);
                commandParameters[5] = DBHelper.createParameter("@KhoaDonVi", DbType.Int64, ParameterDirection.Input, modGeneral.H_CLIENT);
                commandParameters[6] = DBHelper.createParameter("@ListKhoaTaiKhoan", DbType.Int64, ParameterDirection.Input, listKhoaTaiKhoanCon);
                obj2 = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.StoredProcedure, "BH_BC_KhachNoVuotDinhMuc", commandParameters).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message);
                obj2 = null;
                ProjectData.ClearProjectError();
                return obj2;
                ProjectData.ClearProjectError();
            }
            return obj2;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptKhachHangNoVuotDinhMuc));
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.Label13 = new Label();
            this.TxtTuNgay = new DateTimePicker();
            this.Label1 = new Label();
            this.CboDonVi = new ComboBox();
            this.Panel1 = new Panel();
            this.CmdPrint = new Button();
            this.AdvTaiKhoan = new ADVAccount();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1.SuspendLayout();
            this.VSlist.BeginInit();
            this.SuspendLayout();
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            Point point = new Point(0x310, 0x10);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            Size size = new Size(0x4f, 0x19);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x12;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = ACCOUNTING.My.Resources.Resources.view;
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x263, 0x10);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x19);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 0x11;
            this.CmdOK.Text = "&Xem";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.Label13.AutoSize = true;
            this.Label13.BackColor = Color.Transparent;
            point = new Point(6, 5);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x4e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 40;
            this.Label13.Text = "T\x00ednh đến ng\x00e0y";
            this.TxtTuNgay.Format = DateTimePickerFormat.Short;
            point = new Point(9, 0x16);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x57, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 1;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new Point(0x63, 5);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x37, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 1;
            this.Label1.Text = "T\x00e0i khoản";
            this.CboDonVi.FormattingEnabled = true;
            point = new Point(0x66, 0x36);
            this.CboDonVi.Location = point;
            this.CboDonVi.Name = "CboDonVi";
            size = new Size(0xf3, 0x15);
            this.CboDonVi.Size = size;
            this.CboDonVi.TabIndex = 0;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdPrint);
            this.Panel1.Controls.Add(this.AdvTaiKhoan);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.Label13);
            this.Panel1.Controls.Add(this.CboDonVi);
            this.Panel1.Controls.Add(this.CmdOK);
            this.Panel1.Controls.Add(this.TxtTuNgay);
            this.Panel1.Controls.Add(this.CmdCancel);
            this.Panel1.Dock = DockStyle.Top;
            point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x365, 0x2e);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x13;
            this.CmdPrint.Image = ACCOUNTING.My.Resources.Resources.report;
            this.CmdPrint.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x2b7, 0x10);
            this.CmdPrint.Location = point;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x53, 0x19);
            this.CmdPrint.Size = size;
            this.CmdPrint.TabIndex = 0x75;
            this.CmdPrint.Text = "Trang in";
            this.CmdPrint.UseVisualStyleBackColor = true;
            this.AdvTaiKhoan.Conditions = "";
            this.AdvTaiKhoan.DefaultValue = "131";
            this.AdvTaiKhoan.FieldNameFilter = "Left(SoTaiKhoan,3)";
            this.AdvTaiKhoan.KeyFilter = "131|141|338";
            point = new Point(0x66, 0x16);
            this.AdvTaiKhoan.Location = point;
            Padding padding = new Padding(0);
            this.AdvTaiKhoan.Margin = padding;
            this.AdvTaiKhoan.Name = "AdvTaiKhoan";
            this.AdvTaiKhoan.OnlyDigit = false;
            this.AdvTaiKhoan.ReadOnly = false;
            size = new Size(0x162, 20);
            this.AdvTaiKhoan.Size = size;
            this.AdvTaiKhoan.TabIndex = 0x31;
            this.AdvTaiKhoan.UpperText = true;
            this.AdvTaiKhoan.Value = "";
            this.AdvTaiKhoan.WithCode = 80;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new Point(0, 0x2e);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.Rows.MaxSize = 0x12;
            this.VSlist.Rows.MinSize = 0x12;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x365, 0x20a);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 120;
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x365, 0x238);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptKhachHangNoVuotDinhMuc";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-BH09             ";
            this.Text = "KHACH HANG NO VUOT DINH MUC";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.VSlist.EndInit();
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            DataTable data = (DataTable) this.GetData();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            int num2 = data.Rows.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                vSlist.AddItem("");
                vSlist[i + 1, 0] = RuntimeHelpers.GetObjectValue(data.Rows[i]["KhoaDoiTuong"]);
                vSlist[i + 1, 1] = RuntimeHelpers.GetObjectValue(data.Rows[i]["MaDoiTuong"]);
                vSlist[i + 1, 2] = RuntimeHelpers.GetObjectValue(data.Rows[i]["TenDoiTuong"]);
                vSlist[i + 1, 3] = RuntimeHelpers.GetObjectValue(data.Rows[i]["DienThoai"]);
                vSlist[i + 1, 4] = RuntimeHelpers.GetObjectValue(data.Rows[i]["MaSoThue"]);
                vSlist[i + 1, 5] = RuntimeHelpers.GetObjectValue(data.Rows[i]["DinhMuc"]);
                vSlist[i + 1, 6] = RuntimeHelpers.GetObjectValue(data.Rows[i]["SoNoHienTai"]);
            }
            vSlist = null;
        }

        private void PrintReport()
        {
            this.Cursor = Cursors.WaitCursor;
            ReportModule.InitDuLieuDanhMuc(Conversions.ToString(modGeneral.CreatKey("BC_DuLieuDanhMuc", 10, "")), this.VSlist, 0, 1, "");
            DataTable data = (DataTable) this.GetData();
            if (data.Rows.Count == 0)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
            }
            else if (data != null)
            {
                Rpt_NoVuotDinhMuc muc = new Rpt_NoVuotDinhMuc();
                try
                {
                    muc.SetDataSource(data);
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        muc.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                    }
                    else
                    {
                        muc.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                    }
                    muc.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    muc.SetParameterValue(2, modGeneral.Tranlated("T\x00e0i khoản", "") + ": " + modGeneral.H_ACCOUNTNAME + " " + modGeneral.Tranlated("Tại", "") + ":" + modGeneral.H_BANK);
                    muc.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    muc.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    muc.SetParameterValue(5, modGeneral.Tranlated("NỢ VƯỢT ĐỊNH MỨC", ""));
                    muc.SetParameterValue(6, modGeneral.Tranlated("T\x00ednh đến ng\x00e0y", "") + " : " + this.TxtTuNgay.Text);
                    muc.SetParameterValue(7, modGeneral.Tranlated("STT", ""));
                    muc.SetParameterValue(8, modGeneral.Tranlated("M\x00e3 kh\x00e1ch h\x00e0ng", ""));
                    muc.SetParameterValue(9, modGeneral.Tranlated("Kh\x00e1ch h\x00e0ng", ""));
                    muc.SetParameterValue(10, modGeneral.Tranlated("Điện thoại", ""));
                    muc.SetParameterValue(11, modGeneral.Tranlated("M\x00e3 số thuế", ""));
                    muc.SetParameterValue(12, modGeneral.Tranlated("Định mức", ""));
                    muc.SetParameterValue(13, modGeneral.Tranlated("Nợ", ""));
                    muc.SetParameterValue(14, modGeneral.Tranlated("Tổng cộng", ""));
                    muc.SetParameterValue(15, modGeneral.Tranlated("Ng\x00e0y ...... th\x00e1ng ...... năm ...............", ""));
                    muc.SetParameterValue(0x10, modGeneral.Tranlated("Lập Phiếu", ""));
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = muc;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.Cursor = Cursors.Default;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        internal virtual ADVAccount AdvTaiKhoan
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvTaiKhoan;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvTaiKhoan = value;
            }
        }

        internal virtual ComboBox CboDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonVi = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual Button CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTuNgay = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

